package com.ruoyi.web.controller.system;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.WcsZoneMap;
import com.ruoyi.system.service.IWcsZoneMapService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * PLC参数配置Controller
 * 
 * @author ZYT
 * @date 2020-08-30
 */
@RestController
@RequestMapping("/system/WcsZoneMap")
public class WcsZoneMapController extends BaseController
{
    @Autowired
    private IWcsZoneMapService wcsZoneMapService;

    /**
     * 查询PLC参数配置列表
     */
    @PreAuthorize("@ss.hasPermi('system:WcsZoneMap:list')")
    @GetMapping("/list")
    public TableDataInfo list(WcsZoneMap wcsZoneMap)
    {
        startPage();
        List<WcsZoneMap> list = wcsZoneMapService.selectWcsZoneMapList(wcsZoneMap);
        return getDataTable(list);
    }

    /**
     * 导出PLC参数配置列表
     */
    @PreAuthorize("@ss.hasPermi('system:WcsZoneMap:export')")
    @Log(title = "PLC参数配置", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WcsZoneMap wcsZoneMap)
    {
        List<WcsZoneMap> list = wcsZoneMapService.selectWcsZoneMapList(wcsZoneMap);
        ExcelUtil<WcsZoneMap> util = new ExcelUtil<WcsZoneMap>(WcsZoneMap.class);
        return util.exportExcel(list, "WcsZoneMap");
    }

    /**
     * 获取PLC参数配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:WcsZoneMap:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(wcsZoneMapService.selectWcsZoneMapById(id));
    }

    /**
     * 新增PLC参数配置
     */
    @PreAuthorize("@ss.hasPermi('system:WcsZoneMap:add')")
    @Log(title = "PLC参数配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WcsZoneMap wcsZoneMap)
    {
        return toAjax(wcsZoneMapService.insertWcsZoneMap(wcsZoneMap));
    }

    /**
     * 修改PLC参数配置
     */
    @PreAuthorize("@ss.hasPermi('system:WcsZoneMap:edit')")
    @Log(title = "PLC参数配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WcsZoneMap wcsZoneMap)
    {
        return toAjax(wcsZoneMapService.updateWcsZoneMap(wcsZoneMap));
    }

    /**
     * 删除PLC参数配置
     */
    @PreAuthorize("@ss.hasPermi('system:WcsZoneMap:remove')")
    @Log(title = "PLC参数配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wcsZoneMapService.deleteWcsZoneMapByIds(ids));
    }
}
